package com.link.base.core.basic.config.mvc;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Li Yang
 */
@Configuration
@EnableWebMvc
public class AppContextResourceConfig extends WebMvcConfigurerAdapter {

    @Bean
    public ReloadableResourceBundleMessageSource messageSource() {
        ReloadableResourceBundleMessageSource rrbms = new ReloadableResourceBundleMessageSource();
        rrbms.setBasenames("classpath:i18n/applicationResources", "classpath:i18n/ValidationMessages");
        rrbms.setDefaultEncoding("UTF-8");
        rrbms.setCacheSeconds(0);
        return rrbms;
    }
}
